﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestCAI.DTO;

namespace TestCAI.Controllers
{
    public class CAIHistoryController :_BaseController
    {
        //
        // GET: /CAIHistory/
       public ActionResult CAIHistory()
        {
            TestCAI.Models.CaiHistoryViewModel model = new TestCAI.Models.CaiHistoryViewModel();
                        
            model.ShoppingCenters = ShoppingCenters;
           
            return View(model);
        }

        [HttpPost]
        public ActionResult CAIHistory(TestCAI.Models.CaiHistoryViewModel model, FormCollection collection)
        {
            //collection["StoreNumber"]

           // TestCAI.Models.CaiHistoryViewModel model = new TestCAI.Models.CaiHistoryViewModel();

            model.ShoppingCenters = ShoppingCenters;

            CaiDTO cai;
            model.lstCAI = new List<CaiDTO>();


            if (model.StoreNumber == 352)
            {
                cai = new CaiDTO();
                cai.User = "Oakbridge - 3/12/13";
                cai.CaiID = 1;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Oakbridge - 7/12/13";
                cai.CaiID = 1;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Oakbridge - 11/12/13";
                cai.CaiID = 1;

                model.lstCAI.Add(cai);
            }
            else if (model.StoreNumber == 356)
            {
                cai = new CaiDTO();
                cai.User = "Lake Miriam - 3/16/13";
                cai.CaiID = 6;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Lake Miriam - 7/16/13";
                cai.CaiID = 6;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Lake Miriam - 10/16/13";
                cai.CaiID = 6;

                model.lstCAI.Add(cai);
            }
            else if (model.StoreNumber == 1270)
            {
                cai = new CaiDTO();
                cai.User = "Southgate - 3/22/13";
                cai.CaiID = 9;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Southgate - 7/22/13";
                cai.CaiID = 9;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Southgate - 10/22/13";
                cai.CaiID = 9;

                model.lstCAI.Add(cai);
            }
            else if (model.StoreNumber == 111)
            {
                cai = new CaiDTO();
                cai.User = "Other - 3/1/13";
                cai.CaiID = 10;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Other - 7/1/13";
                cai.CaiID = 10;

                model.lstCAI.Add(cai);

                cai = new CaiDTO();
                cai.User = "Other - 11/1/13";
                cai.CaiID = 10;

                model.lstCAI.Add(cai);
            }





           return View(model);
        }


        public ActionResult ViewCAI(int id)
        {
            CaiDTO model;

            if (id == 1)
            {
                model = new CaiDTO();
                model.User = "James Hiatt";
                model.GutterDownSpout = true;
                model.GutterDownSpoutComm = "Comments for gutters.";
                model.Leaks = false;
                model.LeaksComm = "Some comments for leaks.";
                model.ShoppingCenter = "Oakbridge";
                model.ExtBldLighting = true;
                model.ExtBldLightingComm = "Looks good to me.";
                model.PlLightPoles = true;
                model.PlLightPolesComm = "Nicely done.";
            }else if (id == 6) 
            {
                model = new CaiDTO();
                model.User = "Greg McManus";
                model.GutterDownSpout = true;
                model.GutterDownSpoutComm = "Comments for gutters.";
                model.Leaks = false;
                model.LeaksComm = "Some comments for leaks.";
                model.ShoppingCenter = "Lake Miriam";
                model.ExtBldLighting = true;
                model.ExtBldLightingComm = "Looks good to me.";
                model.PlLightPoles = true;
                model.PlLightPolesComm = "Nicely done.";
            }
            else if (id == 9)
            {
                model = new CaiDTO();
                model.User = "Chris Wood";
                model.GutterDownSpout = true;
                model.GutterDownSpoutComm = "Comments for gutters.";
                model.Leaks = false;
                model.LeaksComm = "Some comments for leaks.";
                model.ShoppingCenter = "Southgate";
                model.ExtBldLighting = true;
                model.ExtBldLightingComm = "Looks good to me.";
                model.PlLightPoles = true;
                model.PlLightPolesComm = "Nicely done.";
            }
            else if (id == 10)
            {
                model = new CaiDTO();
                model.User = "Some Person";
                model.GutterDownSpout = true;
                model.GutterDownSpoutComm = "Comments for gutters.";
                model.Leaks = false;
                model.LeaksComm = "Some comments for leaks.";
                model.ShoppingCenter = "Other";
                model.ExtBldLighting = true;
                model.ExtBldLightingComm = "Looks good to me.";
                model.PlLightPoles = true;
                model.PlLightPolesComm = "Nicely done.";
            }
            else
            {
                model = new CaiDTO();
            }

            return View(model);
        }
    }
}
